const debug = process.env.NODE_ENV !== "production";

const COMMON_TYPES = {
  ROLE_CHECKED_KEYS: "ROLE_CHECKED_KEYS",
  FLY_NUM: "FLY_NUM",
  RECEIPT_INIT_STATUS: "RECEIPT_INIT_STATUS",
  BASIC_INFO: "BASIC_INFO",
  MAP_INTERVAL_TIME: "MAP_INTERVAL_TIME"
};

const state = {
  roleCheckedKeys: [],
  flyNum: 0,
  receiptInitStatus: false,
  basicInfo: {},
  mapIntervalTime: 0,
};
const getters = {};

const mutations = {
  [COMMON_TYPES.ROLE_CHECKED_KEYS] (state, roleCheckedKeys = []) {
    state.roleCheckedKeys = roleCheckedKeys;
  },
  [COMMON_TYPES.FLY_NUM] (state, flyNum = 0) {
    state.flyNum = flyNum;
    localStorage.batchNum = flyNum;
  },
  [COMMON_TYPES.RECEIPT_INIT_STATUS] (state, receiptInitStatus) {
    state.receiptInitStatus = receiptInitStatus;
  },
  [COMMON_TYPES.BASIC_INFO] (state, basicInfo = {}) {
    state.basicInfo = basicInfo;
  },
  [COMMON_TYPES.MAP_INTERVAL_TIME] (state, data) {
    state.mapIntervalTime = data
  },
};

const actions = {};

export default {
  strict: debug,
  namespaced: true,
  state,
  getters,
  mutations,
  actions
};
